package cn.itcast.hotel.controller;

import cn.itcast.hotel.pojo.RequestParam;
import cn.itcast.hotel.pojo.PageResult;
import cn.itcast.hotel.service.IHotelService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author guozidi  2023-7-30
 * @Description
 * @package cn.itcast.hotel.controller
 */
@RestController
@RequestMapping("/hotel")
public class HotelController {

    @Resource
    private IHotelService hotelService;

    @PostMapping("list")
    public PageResult list(@RequestBody RequestParam dto){
        return hotelService.search(dto);
    }

    @PostMapping("filters")
    public Map<String, List<String>> filter(@RequestBody RequestParam dto){
        return hotelService.filters(dto);
    }

}
